//
//  ViewController.m
//  构架模式MVP
//
//  Created by XHJ on 2020/8/27.
//  Copyright © 2020 L. All rights reserved.
//

#import "ViewController.h"
#import "MVPProtocol.h"
#import "Presenter.h"

@interface ViewController () <MVPProtocol>

@property (nonatomic, strong)Presenter *p;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    _p = [[Presenter alloc] init];
    [_p attachView:self];
    [_p load];
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(100, 100, 100, 50);
    [button setTitle:@"MVPButton" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(buttonClcik:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    [button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
}
- (void)buttonClcik:(UIButton *)btn {
    [_p getOne];
}
- (void)didSelected:(id)data {
    NSLog(@" data : %@", data);
}
@end
